#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDialog>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    QDialog* dialog=new QDialog(this);
    // 设置对话框大小
    dialog->resize(400,300);
    dialog->show();
    //每次点击都会创建一个对话框,所以需要点叉时释放
    dialog->setAttribute(Qt::WA_DeleteOnClose);
}
